import request from '@/utils/request'

// 获取图片验证码
export function captcha(data = {}) {
  return request({
    url: '/tenant/captcha',
    method: 'get',
    params: data
  })
}
// 加密登录
export function login(data = {}) {
  return request({
    url: '/tenant/login',
    method: 'get',
    params: data
  })
}
// 加密登录
export function loginNoPwd(data = {}) {
  return request({
    url: '/tenant/loginNoPwd',
    method: 'get',
    params: data
  })
}
// 获取用户信息
export function getUserinfo(data = {}) {
  return request({
    url: '/tenant/info',
    method: 'get',
    params: data
  })
}
// 退出登录
export function logout(data = {}) {
  return request({
    url: '/tenant/logout',
    method: 'get',
    params: data
  })
}
// 清除登录错误限制
export function clear(data = {}) {
  return request({
    url: '/tenant/clear',
    method: 'get',
    params: data
  })
}
// 获取验证码
export function getAuthSms(data = {}) {
  return request({
    url: '/tenant/sms',
    method: 'get',
    params: data
  })
}



// 组织架构
// 新增组织
export function groupAdd(data = {}) {
  return request({
    url: '/tenant/group/create',
    method: 'post',
    data: data
  })
}
// 删除组织
export function groupDel(data = {}) {
  return request({
    url: '/tenant/group/remove',
    method: 'DELETE',
    params: data
  })
}
// 修改组织
export function groupEdit(data = {}) {
  return request({
    url: '/tenant/group/update',
    method: 'put',
    data: data
  })
}
// 组织详情
export function groupDtl(data = {}) {
  return request({
    url: '/tenant/group/get',
    method: 'get',
    params: data
  })
}
// 组织架构树1
export function groupTree(data = {}) {
  return request({
    url: '/tenant/group/tree',
    method: 'get',
    params: data
  })
}


// 组织架构树2
export function tenantTree(data = {}) {
  return request({
    url: '/tenant/group/tenantTree',
    method: 'get',
    params: data
  })
}



// 组织成员
// 新增成员
export function memberAdd(data = {}) {
  return request({
    url: '/tenant/member/create',
    method: 'post',
    data: data
  })
}
// 删除成员
export function memberDel(data = {}) {
  return request({
    url: '/tenant/member/delete',
    method: 'get',
    params: data
  })
}
// 修改成员
export function memberEdit(data = {}) {
  return request({
    url: '/tenant/member/update',
    method: 'put',
    data: data
  })
}
// 成员详情
export function memberDtl(data = {}) {
  return request({
    url: '/tenant/member/detail',
    method: 'get',
    params: data
  })
}
// 成员列表
export function memberList(data = {}) {
  return request({
    url: '/tenant/member/list',
    method: 'get',
    params: data
  })
}
// 修改密码
export function memberChangPwd(data = {}) {
  return request({
    url: '/tenant/member/changPwd',
    method: 'put',
    params: data
  })
}

// 租户
// 新增租户
export function tenantAdd(data = {}) {
  return request({
    url: '/tenant/tenant/create',
    method: 'post',
    data: data
  })
}
// 删除租户
export function tenantDel(data = {}) {
  return request({
    url: '/tenant/tenant/delete',
    method: 'get',
    params: data
  })
}
// 修改租户
export function tenantEdit(data = {}) {
  return request({
    url: '/tenant/tenant/update',
    method: 'post',
    data: data
  })
}
// 租户列表
export function tenantList(data = {}) {
  return request({
    url: '/tenant/tenant/page',
    method: 'get',
    params: data
  })
}
// 租户列表
export function tenantInfo(data = {}) {
  return request({
    url: '/tenant/tenant/byMember',
    method: 'get',
    params: data
  })
}


// 开启账户
export function openAccount(data = {}) {
  return request({
    url: '/tenant/member/open',
    method: 'put',
    params: data
  })
}

// 关闭账户
export function closeAccount(data = {}) {
  return request({
    url: '/tenant/member/close',
    method: 'put',
    params: data
  })
}


// 角色新增
export function roleAdd(data = {}) {
  return request({
    url: '/tenant/role/create',
    method: 'post',
    data: data
  })
}
// 角色列表
export function roleList(data = {}) {
  return request({
    url: '/tenant/role/list',
    method: 'get',
    params: data
  })
}
// 角色删除
export function roleDel(data = {}) {
  return request({
    url: '/tenant/role/remove',
    method: 'get',
    params: data
  })
}

// 职位新增
export function jobAdd(data = {}) {
  return request({
    url: '/tenant/job/create',
    method: 'post',
    data: data
  })
}
// 职位列表
export function jobList(data = {}) {
  return request({
    url: '/tenant/job/list',
    method: 'get',
    params: data
  })
}
// 职位删除
export function jobDel(data = {}) {
  return request({
    url: '/tenant/job/remove',
    method: 'get',
    params: data
  })
}
